class TrucksController < ApplicationController
  def index
    @trucks = Truck.paginate(:page => params[:page], :per_page => 20, :order => "name")
  end

  def new
    @truck = Truck.new
  end

  def create
    @truck = Truck.new(params[:truck])

    respond_to do |format|
      if @truck.save
        format.html  { redirect_to(@truck,
                      :notice => 'Truck was successfully created.') }
      else
        format.html  { render :action => "new" }
      end
    end
  end

  def show
    @active_tab = 'truck_details'
    @truck = Truck.find(params[:id])
  end

  def attributes
    @active_tab = 'truck_attributes'
    @truck = Truck.find(params[:id])
    
    render 'show'
  end

  def conditions
    @active_tab = 'truck_conditions'
    @truck = Truck.find(params[:id])
    
    render 'show'
  end

  def ownerships
    @active_tab = 'truck_ownerships'
    @truck = Truck.find(params[:id])
    
    render 'show'
  end

  def rates
    @active_tab = 'truck_rates'
    @truck = Truck.find(params[:id])
    
    render 'show'
  end
end
